package javachongkao.编程基础.计算钱币;

import java.util.Scanner;
//7-22 计算钱币
//编写程序，读取用户输入的代表总金额的double值，打印表示该金额所需的最少纸币张数和硬币个数，打印从最大金额开始。纸币的种类有十元、五元、一元，硬币的种类有五角、一角、贰分、壹分。
//
//提示：
//由于java浮点数精度问题，建议输入金额后做如下处理：
//
//double totalMoney = in.nextDouble();
//int total = (int)(totalMoney*1000);
//输入格式:
//47.63
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        double totalMoney = scanner.nextDouble();
        int total = (int)(totalMoney * 100);
        int tenYuan = total / 1000;
        int fiveYuan = (total % 1000) / 500;
        int oneYuan = (total % 1000) % 500 / 100;
        int fiftyJiao = (total % 1000) % 500 % 100 / 50;
        int oneJiao = (total % 1000)% 500 % 100 % 50 / 10;
        int twoFen = (total % 1000) % 500 % 100 % 50 % 20 / 10;
        int oneFen = (total % 1000) % 500 % 100 % 50 % 20 % 2;
        System.out.println(tenYuan + " 张十元");
        System.out.println(fiveYuan + " 张五元");
        System.out.println(oneYuan + " 张一元");
        System.out.println(fiftyJiao + " 个五角");
        System.out.println(oneJiao + " 个一角");
        System.out.println(twoFen + " 个贰分");
        System.out.println(oneFen + " 个壹分");

        scanner.close();
    }
}